package com.autonavi.yunda.yunji.core.vo.response;

import com.autonavi.yunda.yunji.core.enums.EngineType;
import com.autonavi.yunda.yunji.core.enums.InterfaceBuildType;
import com.autonavi.yunda.yunji.core.enums.InterfaceStatus;
import com.autonavi.yunda.yunji.core.enums.Method;
import com.autonavi.yunda.yunji.core.model.dto.InterfaceConfigDTO;
import com.autonavi.yunda.yunji.core.model.dto.ProjectDTO;
import com.autonavi.yunda.yunji.core.model.vo.InterfaceData;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.sql.Timestamp;

/**
 * @author cizhong.wcs
 * @date 2023/2/17 15:07
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class InterfaceConfigDetailVO {
    private Long id;
    private String name;
    private String description;
    private String uri;
    private Method method;
    private String version;
    private String projectId;
    private String engineData;
    private String extraData;
    private InterfaceData interfaceData;
    private InterfaceStatus status;
    private InterfaceBuildType buildType;
    private EngineType engineType;
    private String grayIps;
    private Boolean exposedByRestapi;
    private String createUser;
    private String updateUser;
    private Timestamp createTime;
    private Timestamp updateTime;
    private ProjectDTO projectDTO;


    public static InterfaceConfigDetailVO from(InterfaceConfigDTO dto, ProjectDTO projectDTO) {
        InterfaceConfigDetailVO vo = new InterfaceConfigDetailVO();
        BeanUtils.copyProperties(dto, vo);
        vo.setProjectDTO(projectDTO);
        return vo;
    }
}
